/*
 * @Author: zwz
 * @Date: 2023-05-28 16:08:25
 * @LastEditors: zwz
 * @LastEditTime: 2023-06-06 11:23:06
 * @Description: 请填写简介
 */
'use strict'

module.exports = (app) => {
  const { STRING, INTEGER, DATE } = app.Sequelize
//   const DataTypes = app.Sequelize;
  const User = app.model.define('user', {
    // id是自动生成的
    // id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    username: STRING(30),
    password: STRING(30),
    age: INTEGER,
    created_at: DATE,
    updated_at: DATE,
  });
  User.findByLogin = async function(username) {
    return await this.findOne({
      where: {
        username: username
      }
    });
  }
  return User
}